package com.cryptoneedle.center.repository.doris;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.center.common.entity.doris.DorisDatabase;
import com.cryptoneedle.center.common.key.DatabaseKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: Doris-元数据-Database </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
@DS("pg")
public interface DorisDatabaseRepository extends BaseRepository<DorisDatabase, DatabaseKey> {

    @Query("FROM DorisDatabase ORDER BY catalogName, databaseName")
    List<DorisDatabase> list();

    @Query("FROM DorisDatabase WHERE catalogName = :catalogName ORDER BY catalogName, databaseName")
    List<DorisDatabase> listByCatalog(String catalogName);
}